# Maintainer: Johannes Löthberg <johannes@kyriasis.com>

pkgname=(python-prometheus_client python2-prometheus_client)
pkgver=0.3.1
pkgrel=1

pkgdesc="Prometheus instrumentation library for Python applications"
url="https://github.com/prometheus/client_python"
arch=('any')
license=('APACHE')

makedepends=('python' 'python-setuptools'
             'python2' 'python2-setuptools')
checkdepends=('python-twisted' 'python2-twisted' 'python2-futures')

source=(client_python-$pkgver.tar.gz::https://github.com/prometheus/client_python/archive/v${pkgver}.tar.gz)
sha512sums=('939a985bcf6b377d353871333634ab1641f50288c531ab70b3e5e5466362c02012ae6cf0adf889dac96a89fc5ce29462aa62e651ce21c15d40647d6465baab1a')

prepare() {
  cp -r client_python-$pkgver client_python-$pkgver-py2
}

build() {
  cd client_python-$pkgver
  python setup.py build

  cd "$srcdir"/client_python-$pkgver-py2
  python2 setup.py build
}

check() {
  cd client_python-$pkgver
  python setup.py test

  cd "$srcdir"/client_python-$pkgver-py2
  python2 setup.py test
}

package_python-prometheus_client() {
  depends=('python')

  cd client_python-$pkgver
  python setup.py install --root="$pkgdir" --skip-build --optimize=1
}

package_python2-prometheus_client() {
  depends=('python2')

  cd client_python-$pkgver
  python2 setup.py install --root="$pkgdir" --skip-build --optimize=1
}
